package test3_12;

import java.util.Scanner;

public class Homework6_5_threeMax {
    public static void main(String[] args) {
        /*
        从键盘中接收用户输入的10个数值，输出最大的三个
         */

        //设置输入十个数
        Scanner sc = new Scanner(System.in);
        int[] num = new int[10];
        System.out.println("请输入10个数:");
        for (int i = 0; i < num.length; i++) {
            num[i] = sc.nextInt();
        }

        //外层循环执行三次，输出三个最大值
        for (int i = 0; i < 3; i++) {
            //内层循环通过比较，把最大的放在num[i]的位置
            for (int j = i+1; j < num.length; j++) {
                if (num[i] < num[j]) {
                    int tmp;
                    tmp = num[j];
                    num[j] = num[i];
                    num[i] = tmp;
                }
            }
            System.out.print(num[i] + " ");
        }
    }
}
